#ifndef __DATA_STRUCT_H__
#define __DATA_STRUCT_H__

/**
 * 每个月的还款信息
 */
typedef struct per_month_pay_info{
    double interest;//利息额
    double capital; //本金额
    double capital_already_pay; //累计已还本金额
    double interest_already_pay; //累计已还利息额
    double capital_future_pay; //剩余要还的本金
    double interest_future_pay; //剩余要还的利息
} per_info_t;

/**
 * 总还款信息
 */
typedef struct total_pay_info{
    double year_rate;//年利率
    double month_rate; //月利率
    double total_money; //贷款总额
    int total_months;//贷款期数,以月为单位
    double money_per_month; //每月固定还款额
    double total_pay; //总还款额
    double total_interest;//总利息
    struct per_month_pay_info *vec; //所有月份的还款数组
} total_info_t;;


void init_total_pay_info(total_info_t* info, double total_money,int total_months,double year_rate);

/**
 * 打印总还款信息
 */
void print_total_pay_info(total_info_t * info);

void print_one_month(total_info_t * info, int month);

total_info_t* shift_pay(total_info_t* info,int event_month,double forward_money);
#endif
